package com.zc.utils;

import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Calendar;
import java.util.Date;

public class ZcUtil {

    /**
     * 获取当前服务器ip
     * @return
     */
    public static String getServerIp() {
        String serverIp = null;
        try {
            InetAddress ip4 = Inet4Address.getLocalHost();
            serverIp = ip4.getHostAddress();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
        return serverIp;
    }

    public static Date dateAddMinute(int amount){
       /* //方法一
        Date afterDate = new Date(date .getTime() + 300000);
        System.out.println("当前时间加5分钟：" + sdf.format(afterDate ));*/

        //方法二
        Calendar nowTime = Calendar.getInstance();
        nowTime.add(Calendar.MINUTE, 5);

        return  nowTime.getTime();

    }
}
